import request from '@/utils/request'

// 查询素材图片列表
export function getImageList(query) {
  return request({
    url: '/system/material/image/list',
    method: 'get',
    params: query
  })
}
// 删除图片素材
export function delImage(id) {
  return request({
    url: '/system/material/image/'+id,
    method: 'delete',
  })
}
// 查看图片素材详情
export function getImageInfo(id) {
  return request({
    url: '/system/material/image/'+id,
    method: 'get',
  })
}
// 查询素材视频列表
export function getVideoList(query) {
  return request({
    url: '/system/material/video/list',
    method: 'get',
    params: query
  })
}
// 删除视频素材
export function delVideo(id) {
  return request({
    url: '/system/material/video/'+id,
    method: 'delete',
  })
}
// 查询素材文本列表
export function getTextList(query) {
  return request({
    url: '/system/material/text/list',
    method: 'get',
    params: query
  })
}
// 删除文本素材
export function delText(id) {
  return request({
    url: '/system/material/text/'+id,
    method: 'delete',
  })
}

// 查询素材视频列表
export function getVideoClipSearch(data) {
  return request({
    url: '/system/algo/videoClipSearch',
    method: 'get',
    params: data
  })
}
// 新增文本素材
export function addText(data) {
  return request({
    url: '/system/material/text/',
    method: 'post',
    data
  })
}
// 上传素材
export function uploadMaterial(data, config) {
  return request({
    url: '/system/meta/upload',
    method: 'post',
    data,
    ...config
  })
}
// 素材统计
export function getMaterialStatistics(query) {
  return request({
    url: '/system/meta/statistics',
    method: 'post',
    params: query
  })
}
// 素材上传记录
export function getRecordList(query) {
  return request({
    url: '/system/record/list',
    method: 'get',
    params: query
  })
}
/**
 * 查询话题列表,不分页
 * @returns 
 */
export function queryTopicList(){
  return request({
    url: '/system/topic/allList',
    method: 'get'
  })
}

/**
 * 查询数据趋势
 * @returns 
 */
export function queryMetaCountList(){
  return request({
    url: '/meta/count/last7Days',
    method: 'get'
  })
}


export function queryImageOrText(params) {
  return request({
    url: '/system/algo/imageOrTextSearch',
    method: 'get',
    params
  })
}
// 查询视频的数据来源
export function queryVideoPubOptions() {
  return request({
    url: '/system/material/video/groupByPublisher',
    method: 'get'
  })
}
// 查询图片的数据来源
export function queryImagePubOptions() {
  return request({
    url: '/system/material/image/groupByPublisher',
    method: 'get'
  })
}
// 查询文本的数据来源
export function queryTextPubOptions() {
  return request({
    url: '/system/material/text/groupByPublisher',
    method: 'get'
  })
}